package com.aoyama.kafka.config;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 项目启动时创建topic
 */
@Configuration
public class KafkaInitialConfiguration {
    // 创建一个名为testtopic的Topic并设置分区数为8，分区副本数为2
    @Bean
    public NewTopic initialTopic() {
        return new NewTopic("topic3",1, (short) 2 );
    }

    @Bean
    public NewTopic updateTopic() {
        return new NewTopic("topic4",2, (short) 2 );
    }
}
